/**
 * Created by LeungZ on 2016/9/6.
 */
class ClusterSrv {
    constructor(commonSrv) {
        "ngInject";
        this._commonSrv = commonSrv;
    }

    getClusterList(para) {
        return this._commonSrv('get', '/ctg-imageconsole-web/cluster/queryClusterList');
    }

    getClusterInfo(code) {
        return this._commonSrv('get', '/ctg-imageconsole-web/k8snode/queryClusterResrTotal', {
            clusterCode: code
        });
    }

    addCluster(para){
        return this._commonSrv('post', '/ctg-imageconsole-web/cluster/addCluster', {
            id:para.id?para.id:undefined,
            clusterName: para.name,
            clusterCode: para.code,
            monitorUrl: para.addr,
            distributedWebUrl: para.distributedWebUrl,
            tengineClusterCode:para.tengineClusterCode
            // lvsUrl: para.lvs
        });
    }

    deleteCluster(para){
        return this._commonSrv('post', '/ctg-imageconsole-web/cluster/deleteCluster', {
            id: para.id
        });
    }

    getPermUser(clusterConfigId){
        return this._commonSrv('get','/ctg-imageconsole-web/cluster/queryAssignUsers',{
            clusterConfigId
        });
    }
    permCluster(para){
        return this._commonSrv('post','/ctg-imageconsole-web/cluster/assign',para);
    }
}
export default ClusterSrv